<html>
<head>
<title>DatabaseUtilLogger.java</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
.ln { color: rgb(0,0,0); font-weight: normal; font-style: normal; }
.s0 { color: rgb(0,0,128); font-weight: bold; }
.s1 { }
.s2 { color: rgb(128,128,128); font-style: italic; }
.s3 { color: rgb(0,128,0); font-weight: bold; }
.s4 { color: rgb(0,0,255); }
</style>
</head>
<BODY BGCOLOR="#ffffff">
<TABLE CELLSPACING=0 CELLPADDING=5 COLS=1 WIDTH="100%" BGCOLOR="#C0C0C0" >
<TR><TD><CENTER>
<FONT FACE="Arial, Helvetica" COLOR="#000000">
DatabaseUtilLogger.java</FONT>
</center></TD></TR></TABLE>
<pre>

<span class="s0">package </span><span class="s1">com.example.lista_zakupow.database.utils; 
 
</span><span class="s0">import </span><span class="s1">android.database.Cursor; 
</span><span class="s0">import </span><span class="s1">android.util.Log; 
 
</span><span class="s0">public class </span><span class="s1">DatabaseUtilLogger { 
    </span><span class="s2">/** 
     * Ta metoda pobiera całą zawartość kurosra (Cursor) i wyświetla ją. 
     */</span><span class="s1"> 
    </span><span class="s0">public static void </span><span class="s1">LogCursorInfo(Cursor c, String debugTag) { 
        Log.i(debugTag, </span><span class="s3">&quot;*** Początek kursora *** &quot; </span><span class="s1">+ </span><span class="s3">&quot; Wyników:&quot; </span><span class="s1">+ c.getCount() + </span><span class="s3">&quot; Kolumn: &quot; </span><span class="s1">+ c.getColumnCount()); 
 
        </span><span class="s2">// Wyświetlenie nazw kolumn.</span><span class="s1"> 
        String rowHeaders = </span><span class="s3">&quot;|| &quot;</span><span class="s1">; 
        </span><span class="s0">for </span><span class="s1">(</span><span class="s0">int </span><span class="s1">i = </span><span class="s4">0</span><span class="s1">; i &lt; c.getColumnCount(); i++) { 
 
            rowHeaders = rowHeaders.concat(c.getColumnName(i) + </span><span class="s3">&quot; || &quot;</span><span class="s1">); 
        } 
        Log.i(debugTag, </span><span class="s3">&quot;KOLUMNY &quot; </span><span class="s1">+ rowHeaders); 
 
        </span><span class="s2">// Wyświetlenie rekordów.</span><span class="s1"> 
        c.moveToFirst(); 
        </span><span class="s0">while </span><span class="s1">(c.isAfterLast() == </span><span class="s0">false</span><span class="s1">) { 
            String rowResults = </span><span class="s3">&quot;|| &quot;</span><span class="s1">; 
            </span><span class="s0">for </span><span class="s1">(</span><span class="s0">int </span><span class="s1">i = </span><span class="s4">0</span><span class="s1">; i &lt; c.getColumnCount(); i++) { 
                rowResults = rowResults.concat(c.getString(i) + </span><span class="s3">&quot; || &quot;</span><span class="s1">); 
            } 
            Log.i(debugTag, </span><span class="s3">&quot;Wiersz &quot; </span><span class="s1">+ c.getPosition() + </span><span class="s3">&quot;: &quot; </span><span class="s1">+ rowResults); 
 
            c.moveToNext(); 
        } 
        Log.i(debugTag, </span><span class="s3">&quot;*** Koniec kursora ***&quot;</span><span class="s1">); 
    } 
} 
</span></pre>
</body>
</html>